package com.qd.common.sys.domain.entity.person;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.cdqidi.valid.group.DefaultGroup;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.Size;
import java.time.LocalDateTime;

/**
 * @author sjk
 * 人员和角色
 */
@Getter
@Setter
@EqualsAndHashCode
public class PersonRoleDTO {
    @JsonIgnore
    @ExcelIgnore
    private static final String EXCEL_TITLE = "人员和角色关系";
    /**
     * 主键
     */
    @ExcelProperty(value = {EXCEL_TITLE, "关系ID"})
    private String personRoleId;
    /**
     * 人员ID
     */
    @ColumnWidth(35)
    @ExcelProperty(value = {EXCEL_TITLE, "*人员ID"})
    @Size(max = 50, message = "人员ID长度不能超过{max}位", groups = DefaultGroup.class)
    private String personId;
    /**
     * 人员显示值
     */
    @ExcelProperty(value = {EXCEL_TITLE, "人员姓名"})
    private String personIdDisplay;
    /**
     * 角色ID
     */
    @ExcelProperty(value = {EXCEL_TITLE, "*角色ID"})
    @Size(max = 50, message = "角色ID长度不能超过{max}位", groups = DefaultGroup.class)
    private String roleId;
    /**
     * 角色显示值
     */
    @ExcelProperty(value = {EXCEL_TITLE, "角色名称"})
    private String roleIdDisplay;
    /**
     * 添加时间
     */
    @ExcelProperty(value = {EXCEL_TITLE, "添加时间"})
    private LocalDateTime addTime;
    /**
     * 更新时间
     */
    @ExcelIgnore
    private LocalDateTime updateTime;

    public void freeData() {
        this.personRoleId = null;
        this.personId = null;
        this.personIdDisplay = null;
        this.roleId = null;
        this.roleIdDisplay = null;
        this.addTime = null;
        this.updateTime = null;
    }
}
